using UnityEngine;
using System.Collections;

public class FadeIn : MonoBehaviour
{
    private GUITexture texture;
    public float secondsToFade;
    private float count;

    public void Start()
    {
        count = 1;
        texture = GetComponent<GUITexture>();
        Time.timeScale = 1;
    }

    void Update()
    {
        count -= 1 / secondsToFade * Time.deltaTime;
        texture.guiTexture.color = new Color(0, 0, 0, count);

        if(count <= 0)
        {
            Destroy(gameObject);
        }
    }
}
